<%@ page import="java.net.*"%>

<%
// check for cookie set
String spiceDocuName = "spiceDocuSkipp";
Cookie[] cookies = request.getCookies();
boolean docuSkipped = false;
 
if ( cookies != null ) {
   for ( int i=0 ; i< cookies.length ; i++) {
       Cookie c = cookies[i];
       if ( c.getName().equals(spiceDocuName)){
              String cookieVal = c.getValue();
	      if ( cookieVal.equals("true"))
	          docuSkipped = true;
	  //System.out.println(c);
       }
   }
}



	 String pdb = request.getParameter("pdb");
	 String type = "PDB" ;
	 String code = pdb;
	 if ( pdb != null ) {
	   
	    code = pdb.toLowerCase() ;
	 } else {
	    String uniprot = request.getParameter("uniprot");
	    if ( uniprot != null ) {
	       type="UniProt";
	       code = uniprot;
	    }
	 }

	 String ensp = request.getParameter("ensp");
	 if (  ensp != null ) {
	 	type="ENSP";
		code = ensp;
	 }
	 
	 if ( (code == null ) || (code.equals(""))) {	 
	   code = "1boi";
	   type="PDB";
	 }
	
	

if ( docuSkipped ) {
  %>
 <jsp:forward page="runspice.jsp"/>
 <% 
} else { 
   Cookie c = new Cookie(spiceDocuName,"false");
   int max_age_seconds = 60*60*24*7*4; // 4 weeks
   c.setMaxAge(max_age_seconds);
   response.addCookie(c);
   %>

   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
   <html>
   <head>
   <title>The SPICE -  browser</title>
   <link rel="stylesheet" type="text/css" href="http://www.efamily.org.uk/css/nefamily.css" />
   </head>
   <body>

<div id="content">

<div id="nav">
       <ul> 
       <li><a  href="http://www.dasregistry.org/spice/index.shtml">SPICE - About</a></li>
       <li><a  href="http://www.dasregistry.org/spice/spice.shtml">SPICE - Run</a></li>
       <li><a  href="http://www.dasregistry.org/spice/faq.shtml">SPICE - FAQ</a></li>
       <li><a  href="http://www.sanger.ac.uk/Users/ap3/DAS/SPICE/SPICE_manual.pdf">SPICE - Manual</a></li>
       <li><a  href="http://lists.sanger.ac.uk/mailman/listinfo/spice-das">SPICE - Mailing List</a></li>
       <li><a  href="http://www.dasregistry.org/spice/promote.shtml">SPICE - link to</a></li>
	</ul>


	    <% if ( type.equals("PDB") && (! code.equals("default"))) {
	      if ( code.length() >=4 )  {
	      %>
	       <a href="runspice.jsp?<%=request.getQueryString()%>"><img src="http://www.ebi.ac.uk/pdbe-srv/view/images/entry/<%      
	        out.print(code.substring(0,4));

		%>_cbc600.png" width="150"></a> image of <%=code%> provided by <a href="http://www.ebi.ac.uk/msd/">MSD</a>.
	      <%
	      }
	    }
	    %>
	   



</div>

   <div id="header">
   <h2>The SPICE - browser</h2>
   </div>

   <div id="main">
    
   <% 
   // in the future do not display this information page any more and directly launch SPICE   
   %>

   <form action="showSpiceAction.jsp"/>
   <table>
   <tr>
   <td>	<input type="checkbox" name="showSpice" value="0"/></td>
   <td>do not show this page any more and directly start <strong>SPICE</strong> in future</td>   
   
   <td> <input type="submit" value="launch SPICE"/> </td>   
   <td>(<%=type%>-<%=code%>)</td>
   </tr>
   </table> 
   <input type="hidden" value="<%=request.getQueryString()%>" name="queryS"/>
   </form>


  

   <p>
   Thank you for using <strong>SPICE</strong>. 

   SPICE is a protein sequence and structure browser that is based on the 
   <a href="http://www.biodas.org">DAS</a> protocol.

   
   <%
   //<a href="runspice.jsp?<%=request.getQueryString()% >">
   //<img alt="SPICE screenshot" src="http://www.efamily.org.ukgfx/spice.jpg" height="400" width="451">
   //</a>
   %>
   </p>
   <br/><br/>
   To learn more about SPICE please proceed to the 
   <a href="http://www.dasregistry.org/spice/">SPICE homepage</a>

   <br/><br/>

   SPICE is a Java program that is installed automatically on your computer using
   the Java Web Start technology. To run successfully you need to have either
   <ul><li>Java 1.5 or higher</li>
   </ul>
   installed on your computer. If you have not, please install it from 
   <a href="http://java.sun.com/j2se/1.5.0/download.jsp">here</a>.

   If you have problems with running SPICE, please contact the 
   <a href="http://lists.sanger.ac.uk/mailman/listinfo/spice-das">SPICE -mailing list</a>.

<br/><br/>

   You need to grant SPICE permission in order to
   install. If you have any concerns about this, the complete source code is available 
   under the LGPL from <a href="http://www.derkholm.net/svn/repos/spice/trunk/">here</a>.
   

<br/><br/>

   <p>
   <a href="runspice.jsp?<%=request.getQueryString()%>">   
   Launch SPICE with <%=type%>-<%=code%> now! <img border="0" src="http://www.dasregistry.org/spice/spice_white_46x15.gif"></a>
   </p>
  


</div>
</div>

<%-- the google analytics footer --%>

   </body></html>



<%
}
%>
